﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dominio;

namespace Persistencia
{
    public abstract class Broker
    {
        protected ConBD conexion;

        public static Broker CrearBroker(OPersistente o, ConBD conex)
        {
            Broker br=null;
            if (o.GetType().Name.ToString() == "Usuario")
                br = new BrUsuario();
            if (o.GetType().Name.ToString() == "Cuenta")
                br = new BrCuenta();
            if (o.GetType().Name.ToString() == "Buzon")
                br = new BrBuzon();
            if (o.GetType().Name.ToString() == "Carpeta")
                br = new BrCarpeta();
            if (o.GetType().Name.ToString() == "Mensaje")
                br = new BrMensaje();       

            br.conexion = conex;
            return br;
        }

        public abstract void Agregar(OPersistente o);

        public abstract void Modificar(OPersistente o);

        public abstract void Eliminar(OPersistente o);

        public abstract void TraerDatos(OPersistente o);

        public abstract List<OPersistente> TraerLista(OPersistente o);


    }
}
